<script type="text/javascript" src="./js/tiny_mce/tiny_mce_gzip.js"></script>

<script type="text/javascript">
createTinyMCEOptimalization();
createForumWysiwyg("prispevek");
</script>

<?php

echo "<div class='center'>";
echo "<a class='button preloader' href='".redirect_str(PAGE_FORUM_THEMES)."'>ZPĚT DO TÉMAT</a>";
if($user->getRole() >= ROLE_USER) {
	echo "<a class='button' href='#new_comment'>PŘIDAT PŘÍSPĚVEK</a>";
}
echo "</div><br>";

echo "<div class='center'>";
$query = getForumComments($_GET['id_tema']);
while($fetch = MySQL_Fetch_Array($query)){
	$id = $fetch["ID_PRISPEVEK"];
	$time = DateFormat::format($fetch["CAS"], DF_DDMMYYYYHHMM);
	$nick = $fetch["nick"];
	$text = $fetch["PRISPEVEK"];
	
	echo "<a name='comment".$id."'></a>";
	echo "<div class='report-box' style='margin: 10px auto;'>";
	echo "<div class='header'>".$nick." ($time) napsal</div>";
	echo "<div class='body'><div class='content'>$text</div></div>";
	echo "</div>";
}
echo "</div>";

if($user->getRole() >= ROLE_USER) {

	$code = codegen();
	?>

<br />
<a name='new_comment'></a>
<div class='center'>
<form name='formDiskuzePrispevek' class='centered full'
	action="<? echo redirect_str(PAGE_FORUM_THEME).action(ACTION_NEW_REPLY).add_par("id_tema=".$_GET['id_tema']);?>"
	method='post'><input type="hidden" name="gen_code"
	value="<? echo $code; ?>" />

<fieldset>

<legend>Nový příspěvek</legend>
<table class="full grid">
	<tr>
		<th class="lefted">text příspěvku <span class="star">*</span></th>		
	</tr>
	
	<tr>
		<td class="full"><textarea class="text full h100" id="prispevek"
			name='prispevek_text'><? echo $prispevek_text ?></textarea></td>
	</tr>

	<tr>
		<td><img class="code" src="./inc/codegen.php?code=<?echo $code;?>"></td>
	</tr>

	<tr>
		<th class="lefted">opište číslo z obrázku <span class="star">*</span></th>
	</tr>
	
	<tr>
		<td><input class='text required px70' type='text' maxlength="30"
			id='control_code' name='control_code' value=""></td>
	</tr>

</table>

<div class="center"><input class="button"
	onmouseover="this.className='button_hover'"
	onmouseout="this.className='button'" type="submit"
	value="VLOŽIT PŘÍSPĚVEK"></div>
</fieldset>
</form>
</div>
	<?
}
?>
